namespace Sustainalytics.ESGRatings.Tasks
{
    using System.Collections.Generic;

    using Sustainalytics.LongRunningTaskManager.Interface;

    public static class LRTMContextExtension
    {
        public static void SetErrorToContext(this LongRunningTaskContext context, int errorCode, string errorMessage)
        {
            context.Title = "Failed to generate the ESG Company Report for specified parameters";
            context.TaskStatus.AddError(
                new LongRunningTaskError { ErrorCode = errorCode, Arguments = new List<string> { errorMessage } });
        }
    }
}